<template>
  <h1>{{ props.msg }}</h1>
  <h1>{{ message }}</h1>
  <button @click="edit">子组件的按钮改变</button>
</template>

<script lang="ts">
export default {
  name: 'SonDemo6',
};
</script>

<script lang="ts" setup>
import { ref } from 'vue';
const props = defineProps({
  msg: {
    type: String,
    default: '我是默认值',
    required: true,
  },
});
console.log(props);

const message = ref(props.msg);

const edit = () => {
  message.value = '我是子组件改变后的：举杯邀明月，对影成三人';
};
</script>

<style lang="scss"></style>
